package aerolineas;

import com.lanchita.AerolineaLanchita;
import static aerolineas.MockLanchita.*;

public class LanchitaWrapper {
	private static boolean testing = false;
	
	private AerolineaLanchita lanchita;
	
	public static void setTestMode() {
		testing = true;
	}
	
	private LanchitaWrapper() {
		if(this.isTesting()) {
			this.lanchita = mockLanchita();
		}
		else {
			this.lanchita = AerolineaLanchita.getInstance();
		}
	}
	
	private boolean isTesting() {
		return testing;
	}
	
	public static LanchitaWrapper getInstance() {
		return new LanchitaWrapper();
	}

	public String[][] asientosDisponibles(String origen, String destino,
			String fechaSalida, String horaSalida, String fechaLlegada,
			String horaLlegada) {
		return this.lanchita.asientosDisponibles(origen, destino, fechaSalida, horaSalida, fechaLlegada, horaLlegada);
	}
	
	public void reservar(String codigo, String dni) {
		this.lanchita.reservar(codigo, dni);
	}

	public void comprar(String codigo) {
		this.lanchita.comprar(codigo);
	}
}
